﻿using EFCoreDemo2.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace EFCoreDemo2.EntityConfig
{
    public class StudentConfig : IEntityTypeConfiguration<Student>
    {
        public void Configure(EntityTypeBuilder<Student> builder)
        {
            builder.ToTable("T_Student").ToTable(p=>p.HasComment("学生表")).HasKey(p=>p.Id);
            builder.Property(p => p.Name).IsRequired().HasComment("名称").HasColumnName("StudentName").HasColumnType("nvarchar(64)").HasColumnOrder(1);
        }
    }
}
